 
var sysUser = {
	hashMap : new HashMap(),
	
	cacheHashMap : new HashMap(),
	
	selectedMap : new HashMap(),
	
	/**
	 * 初始化数据
	 */
    init : function(){
    	sysUser.initRole("roleSelect");//初始化角色下拉列表
//    	sysUser.selRole();//初始化第一个角色的权限
//    	$('#multiIdentitySelector').hide();
	},
	
	//修改时初始化
	modifyInit : function(){
		sysUser.initRole('roleSelect');
		sysUser.initRoleRightModify();
		sysUser.modifyInitPhoneAndEmail();
		sysUser.initScope();
	},
	
	/**
	 * 初始化单位角色列表
	 */
	initRole : function(selectId){
		var data = sysUser.ajax("manage/sysUser_getRole.action?rdm="+Math.random());
        if(data == null){
           alert("无法找到对应的角色列表数据!");
           location.href = "manage/sysUser_list.action";
           return;
        }
         data = eval(data);
         var roleSelect = sysUser.getObj(selectId);
         for(var i=0;i<data.length;i++){
         	roleSelect.options.add(new Option(data[i].roleName,data[i].roleId)); 
         }
         
       /*  //根据角色 初始化权限
         sysUser.selRole();*/
	},
	
	//获取用户已选角色
	getUserSelectedRoles : function(){
		var data = sysUser.ajax("manage/sysUser_getUserSelectedRoles.action?rdm="+Math.random());
		if(data == null){
           //sysUser.showTishiDiv("提示","无法获取该用户的角色信息!");
           return;
        }
         data = eval(data);
         var roleDiv = sysUser.getObj("roleDiv");
         var inner = "";
         for(var i=0;i<data.length;i++){
         	  inner += '<input disabled checked type="checkbox" style="margin-left:10px;" id="cb_role'+data[i].roleId+'" name="role" value="'+data[i].roleId+'"><span style="margin-left:5px;">'+data[i].roleName+'</span>';
         }
         roleDiv.innerHTML = inner;
	},
	
	/**
	 * 选择角色
	 */
	selRole : function (){
		var select = sysUser.getObj("roleSelect");
		var showResultDiv = sysUser.getObj("showResultDiv");
		var check = sysUser.getObj("selectedRole_"+select.value);
		if(check == null){
			var inner = '<div id="selectedRole_'+select.value+'">'+
		           '<div style="width:100px;height:30px;float:right"><a href="javascript:void(0)" onclick="sysUser.delSelectedRole(this)">删除</a></div>'+
		           '<div style="width:100px;height:30px;"><a title="查看该角色权限" href="javascript:void(0)" onclick="sysUser.showTheRoleRightList(this)">'+select.options[select.selectedIndex].text+'</a></div>'+
		        '</div>';
			showResultDiv.innerHTML = showResultDiv.innerHTML + inner;
//			sysUser.loadOrgRoleRight(true);
		}else{
			sysUser.showNowRoleAndRightList(select.value);
		}
		//根据角色id判断是否显示显示学段、学科div
		/*if(sysUser.isShowTeacherTjDiv(select.value)){
			sysUser.loadRoleInfo();
			sysUser.showDiv("wsinfoDiv");
		}*/
		
		/*if(sysUser.showGlFwDiv()){
			sysUser.getObj("glfwDiv").style.display = "block";
		}else{
			sysUser.getObj("glfwDiv").style.display = "none";
			sysUser.getObj("glfwTreeDiv").style.display = "none";
		}*/
	},
	
	/**
	 * 加载角色的权限集合
	 * param 是否重新请求数据库加载  false 从内存取数据加载  true重新请求数据库
	 */
	loadOrgRoleRight : function (isReload){
		var select = this.getObj("roleSelect");
		var org_role_id = select.value;
		
		var data = sysUser.ajax("manage/sysUser_getRoleRight.action?org_role_id="+org_role_id+"&rdm="+Math.random());
		//alert(data);
        if(data == null){
           sysUser.showTishiDiv("提示","该角色无对应的权限数据!");
           return;
        }
		var rightArr = new Array();
		var rightListDiv = document.getElementById("rightListDiv");
	    data = eval(data);
		var inner = "";
		for(var i=0;i<data.length;i++){
			     if(isReload){
			     	inner += '<div><p><input type="checkbox" id="'+data[i].id+'" disabled=disabled checked style="margin-right:5px;" onclick="sysUser.clickRoleRightModel(this)">'+data[i].name+'</p><p style="margin-left:20px;">';
			        rightArr.push(data[i].id);
			     }else{
			     	inner += '<div><p><input type="checkbox"  disabled=disabled id="'+data[i].id+'" '+sysUser.filterRoleRight(data[i].id)+' style="margin-right:5px;" onclick="sysUser.clickRoleRightModel(this)">'+data[i].name+'</p><p style="margin-left:20px;">';
			     }
			
		         var children = data[i].children;
		         for(var k=0;k<children.length;k++){
		         	if(isReload){//读取数据库数据
		         	   var checked = "checked";
		         	   if(children[k].enable != null && children[k].enable == false)//修改页面 enable为false
		         	   	    checked = "";
		         	   else//是新增页面或者修改页面时enable为true
		         	        rightArr.push(children[k].id);
		         	   inner += '<input '+checked+' name="rightList"  disabled=disabled value="'+children[k].id+'" onclick="sysUser.clickRoleRight(this)"  type="checkbox" style="margin-right:5px;">'+children[k].name+'&nbsp;&nbsp;&nbsp;&nbsp;';
		         	}
		         	else{//读取hashmap内存数据
		         	   inner += '<input '+sysUser.filterRoleRight(children[k].id)+' name="rightList" value="'+children[k].id+'" onclick="sysUser.clickRoleRight(this)" disabled=disabled type="checkbox" style="margin-right:5px;">'+children[k].name+'&nbsp;&nbsp;&nbsp;&nbsp;'
		         	}
		         }
		         inner += '</p></div>';
		}
		//更新内存选择的角色权限id数据
		if(isReload)
		    sysUser.hashMap.put("orgRole_"+select.value,rightArr);
		
		//更新显示区
		rightListDiv.innerHTML = inner;
		
		//if(isReload)
//		    sysUser.initCheckIsAllUncheck();
    	
		   
	},
	
	
	/**
	 * 修改用户时初始化角色权限信息
	 */
	initRoleRightModify : function(){
		var data = sysUser.ajax("manage/sysUser_getRoleRightModify.action?rdm="+Math.random());
		//alert(data);
		if(data == null){
			sysUser.showTishiDiv("提示","无法获取该用户对应的权限数据");
			return;
		}
		data = eval(data);
		var showResultDiv = sysUser.getObj("showResultDiv");
		var inner = "";
		for(var i=0;i<data.length;i++){
			var roleId = data[i].roleId; 
			if(!sysUser.selectHaveTheValue(roleId))
			    continue;
			var roleName = data[i].roleName;
		    inner += '<div id="selectedRole_'+roleId+'">'+
		           '<div style="width:100px;height:30px;float:right"><a href="javascript:void(0)" onclick="sysUser.delSelectedRole(this)">删除</a></div>'+
		           '<div style="width:100px;height:30px;"><a title="查看该角色权限" href="javascript:void(0)" onclick="sysUser.showTheRoleRightList(this)">'+roleName+'</a></div>'+
		        '</div>';
		        
		    if(i == 0){//默认已选中的第一个角色为下拉框当前选中角色
		    	var select = sysUser.getObj("roleSelect");
				for(var k=0;k<select.options.length;k++){
		     		if(select.options[k].value == roleId){
		     			select.options[k].selected = 'selected';
		     			break;
		     		}
		     	}
		    }
		}
		showResultDiv.innerHTML = showResultDiv.innerHTML + inner;
		//sysUser.hashMap.put("orgRole_"+select.value,rightArr);
		
		for(var i=0;i<data.length;i++){
			var roleId = data[i].roleId; 
			if(!sysUser.selectHaveTheValue(roleId))
			    continue;
	        var rights = data[i].rights;
	        var rightArr = new Array();
			for(var j=0;j<rights.length;j++){
		         var children = rights[j].children;
		         for(var k=0;k<children.length;k++){
		         	 if(children[k].enable == true){
		         	     rightArr.push(children[k].id);
		         	 }
		         }
		         if(!sysUser.haveTheSame(rightArr,rights[j].id))//加入模块id
		         	        rightArr.push(rights[j].id);
			}
			sysUser.hashMap.put("orgRole_"+data[i].roleId,rightArr);
		}
		sysUser.selRole();
	},
	
	/**
	 * 初始化管理范围信息
	 */
	initScope : function(){
		var data = sysUser.ajax("manage/sysUser_getScope.action?rdm="+Math.random());
		//alert(data);
        if(data == null){
          // sysUser.showTishiDiv("提示","无法找到对应的角色管理范围信息!");
           return;
        }
        
        data = eval(data);
        for(var i=0;i<data.length;i++){
        	var roleId = data[i].roleId;
        	if(!sysUser.selectHaveTheValue(roleId))
        	    continue;
        	
        	//选中用户已选的角色
        	sysUser.selectcheckedByValue(sysUser.getObj("roleSelect",roleId));
        	
        	var glfwIdArr = new Array();
        	var glfwNameArr = new Array();
        	var children = data[i].children;
        	for(k=0;k<children.length;k++){
        		var ids = "";
        		var names = "";
        		var pId = null;pName = null;
        		var cId = null;cName = null;
        		var dId = null;dName = null;
        		var sId = null;sName = null;
        		var oId = null;oName = null;
        		pId = children[k].provinceId; pName = children[k].provinceName;
        		cId = children[k].cityId; cName = children[k].cityName;
        		dId = children[k].districtId; dName = children[k].districtName;
        		sId = children[k].schoolId; sName = children[k].schoolName;
        		oId = children[k].eduOrgId; oName = children[k].eduOrgName;
        		
        		if(pId != null && pId != "null"){
        		     ids += pId;
        		     names += pName;
        		}
        		if(cId != null && cId != "null"){
        			ids += ("_"+cId);
        			names += ("&nbsp;&nbsp;"+cName);
        		}
        		if(dId != null && dId != "null"){
        			ids += ("_"+dId);
        			names += ("&nbsp;&nbsp;"+dName);
        		}
        		if(sId != null && sId != "null"){
        			ids += ("_"+sId);
        			names += ("&nbsp;&nbsp;"+sName);
        			
        			$("#orgId").val(sId);
        			$("#type").val("2");
        			
        		}
        		if(oId != null && oId != "null"){
        			ids += ("_"+oId);
        			names += ("&nbsp;&nbsp;"+oName);
        			$("#orgId").val(oId);
        			$("#type").val("1");
        		}
        		
        		//修改时缓存用户之前的数据
        		/*sysUser.showGlfwTree();
        		var zTree = $.fn.zTree.getZTreeObj("glfwtree");
        		var rootNode = zTree.getNodes()[0];
        		
        		glfwIdArr.push(rootNode.id+ids);
        		glfwNameArr.push(rootNode.name+names);
        		sysUser.getObj("glfwTreeDiv").style.display = "none";
        		*/
        		
        		glfwIdArr.push(ids);
        		glfwNameArr.push(names);
        		
        	}
        	sysUser.hashMap.put("glfwId_"+roleId,glfwIdArr);
        	sysUser.hashMap.put("glfwName_"+roleId,glfwNameArr);
        }
        
        sysUser.showGlfwText2();
        
	},
	
	
	/**
	 * 判断当前角色列表中有无该角色
	 * @param {} roleId
	 * @return {}
	 */
	selectHaveTheValue : function(roleId){
		var select = sysUser.getObj("roleSelect");
		var isHave = false;
		for(var i=0;i<select.options.length;i++){
			if(select.options[i].value == roleId){
				isHave = true;
				break;
			}
		}
		return isHave;
	},
	
	
	/**
	 * 判断一个数组中是否有相同的元素
	 * @param {} arr 数组
	 * @param {} child 要添加的元素
	 * @return {Boolean}
	 */
	haveTheSame : function(arr,child){
		if(arr == null || child == null)
		       return true;
		for(var i=0;i<arr.length;i++){
			if(arr[i] == child)
			   return true;
		}
		return false;
	},
	
	/**
	 * 判断arr数组中是否有元素结尾与对应的元素
	 * @param {} arr 数组
	 * @param {} child 要添加的元素
	 * @return {Boolean}
	 */
	haveTheSame2 : function(arr,child){
		if(arr == null || child == null)
		       return true;
		for(var i=0;i<arr.length;i++){
//			if(child.indexOf("_") != -1){
//				var idarr1 = arr[i].split("_");
//				var idarr2 = child.split("_");
//				if(idarr1[idarr1.length-1] == idarr2[idarr2.length-1])
//				    return true;
//			}else{
//				if(arr[i] == child)
//				    return true;
//			}
			var idarr1 = arr[i].split("_");
			var idarr2 = child.split("_");
			if(idarr1[idarr1.length-1] == idarr2[idarr2.length-1])
			    return true;
			
		}
		return false;
	},
	
	
	/**
	 * 新添加一条学制信息(角色完善信息)
	 */
	addInfo : function (){
		var grade = sysUser.getObj("gradeSelect");
		var subject = sysUser.getObj("subjectSelect");
		var edition = sysUser.getObj("editionSelect");
		var volume = sysUser.getObj("volumeSelect");
		var id = "info_"+grade.value+"'"+subject.value+"'"+edition.value+"'"+volume.value;
		if(sysUser.getObj(id) != null)
		    return;
		    
		var select = this.getObj("roleSelect");    
		var roleInfoArr = sysUser.hashMap.get("roleInfo_"+select.value,false);
		if(roleInfoArr == null)
		    roleInfoArr = new Array();
		roleInfoArr.push(id.substring(5));
		sysUser.hashMap.put("roleInfo_"+select.value,roleInfoArr);
		 
		var text = grade.options[grade.selectedIndex].text+'&nbsp;'+subject.options[subject.selectedIndex].text+'&nbsp;'+
		        edition.options[edition.selectedIndex].text+'&nbsp;'+volume.options[volume.selectedIndex].text;
		var showInfoDiv = sysUser.getObj("showInfoDiv");
		var inner = '<div>'+text+'<button type="button" id="'+id+'" onclick="sysUser.delInfo(this)" class="close"  data-dismiss="modal" title="删除" aria-hidden="true">×</button> </div>';
		showInfoDiv.innerHTML = showInfoDiv.innerHTML + inner;
	},
	
	/**
	 * 删除一条学制信息(角色完善信息)
	 */
	delInfo : function (obj){
		var padiv = obj.parentNode;
		sysUser.getObj("showInfoDiv").removeChild(padiv);
		
		var select = sysUser.getObj("roleSelect");    
		var roleInfoArr = sysUser.hashMap.get("roleInfo_"+select.value,false);
		if(roleInfoArr == null)
		    return;
		    
		for(var i=0;i<roleInfoArr.length;i++){
			if(roleInfoArr[i] == obj.id.substring(5)){
				roleInfoArr.splice(i,1);
				if(roleInfoArr.length == 0)
				    sysUser.hashMap.del("roleInfo_"+select.value);
				break;
			}
		}
		if(roleInfoArr.length > 0)
		    sysUser.hashMap.put("roleInfo_"+select.value,roleInfoArr);
		
	},
	/**
	 * 根据选择的角色  显示其已选择的学制信息(角色完善信息)
	 */
	loadRoleInfo : function(){
	    var select = this.getObj("roleSelect");
		var roleInfo = sysUser.hashMap.get("roleInfo_"+select.value,false);
		if(roleInfo == null){
			sysUser.getObj("showInfoDiv").innerHTML = "";
		    return;
		}
		var inner = "";
		for(var i=0;i<roleInfo.length;i++){
			var values = roleInfo[i].split("'");
			var id = "info_"+roleInfo[i];
			var text = sysUser.SelGetTextByValue(values[0],"gradeSelect")+"&nbsp;"+
			           sysUser.SelGetTextByValue(values[1],"subjectSelect")+"&nbsp;"+
			           sysUser.SelGetTextByValue(values[2],"editionSelect")+"&nbsp;"+
			           sysUser.SelGetTextByValue(values[3],"volumeSelect");
			inner += '<div>'+text+'<button type="button" id="'+id+'" onclick="sysUser.delInfo(this)" class="close"  data-dismiss="modal" title="删除" aria-hidden="true">×</button> </div>';
		}
		
		sysUser.getObj("showInfoDiv").innerHTML = inner;
	},
	
		/**
	 * 根据角色id是否显示完善信息div
	 * @param {} roleId 角色id
	 * @return {}
	 */
	isShowTeacherTjDiv : function (roleId){
		var show = false;
		if(roleId == "jyy" || roleId == "37")
		    show = true;
		else
//		    sysUser.closeInfoDiv();
		return show;
	},
	
	/**
	 * 关闭选择范围树
	 */
	closeInfoDiv : function (){
		 var div = document.getElementById("glfwTreeDiv");
	     div.style.display = "none";
	},
	
	
	/**
	 * 显示 点击已选择的权限列表
	 * @param {} obj
	 */
	showTheRoleRightList : function (obj){
		var theDiv = obj.parentNode.parentNode;
		var showRoleId = theDiv.id.split("_")[1];//要显示的角色id
		sysUser.showNowRoleAndRightList(showRoleId);
		
		//根据角色id判断是否显示显示学段、学科div
		if(sysUser.isShowTeacherTjDiv(showRoleId)){
			sysUser.loadRoleInfo();
			sysUser.showDiv("wsinfoDiv");
		}
		
	},
	
	
	/**
	 * 根据角色id显示选择的权限列表
	 * @param roleId 角色id
	 */
	showNowRoleAndRightList : function (roleId){
		var select = sysUser.getObj("roleSelect");
		for(var i=0;i<select.options.length;i++){
     		if(select.options[i].value == roleId){
     			select.options[i].selected = 'selected';
     			sysUser.loadOrgRoleRight(false);
     			break;
     		}
     	}
	},
	
	/**
	 * 删除已选择的角色
	 */
	delSelectedRole : function (obj){
		var theDiv = obj.parentNode.parentNode;
		var delRoleId = theDiv.id.split("_")[1];//删除的角色id
		var showResultDiv = sysUser.getObj("showResultDiv");
		if(showResultDiv.childNodes.length > 1){
			  //内存数据相应的删除
		     sysUser.hashMap.del("orgRole_"+delRoleId);//删除对应的权限
		     sysUser.hashMap.del("roleInfo_"+delRoleId);//删除已选择的信息
		     //更新显示区
		     showResultDiv.removeChild(theDiv);
		     if(sysUser.getObj("roleSelect").value == delRoleId){
		     	var firstSelRoleId = null;
		     	if(sysUser.hashMap.getKey(0) != null){
		     	   firstSelRoleId = sysUser.hashMap.getKey(0).substr(8);//第一个已选择的角色id
		     	   sysUser.showNowRoleAndRightList(firstSelRoleId);
		     	}else{
		     		sysUser.showTishiDiv("提示","无法获取该角色对应的权限数据!");
		     	}
		     }
		     
		}
		else
		     sysUser.showTishiDiv("提示","不允许删除，至少保留一个角色!");
	},
	
	/**
	 * 删除或新增角色权限
	 */
	clickRoleRight : function (obj){
		var roleId = sysUser.getObj("roleSelect").value;
		var right = obj.value;
		var roleRights = sysUser.hashMap.get("orgRole_"+roleId,false);
		
		sysUser.checkIsAllUncheck(obj);
		
		//更新内存对应数据
		if(obj.checked){
			roleRights.push(right);
			sysUser.hashMap.put("orgRole_"+roleId,roleRights);
			return;
		}
		for(var i=0;i<roleRights.length;i++){
			if(roleRights[i] == right){
				roleRights.splice(i, 1);
				sysUser.hashMap.put("orgRole_"+roleId,roleRights);
				break;
			}
		}
		
	},
	
	/**
	 * 点击模块
	 */
	clickRoleRightModel : function (obj){
		var roleId = sysUser.getObj("roleSelect").value;
		sysUser.checkAllOrUncheck(obj);
	},
	
	/**
	 * 点击模块 其下的checkbox全选或全部取消
	 */
	checkAllOrUncheck : function(obj){
		var select = sysUser.getObj("roleSelect");
		var roleId = select.value;
		var rightArr = sysUser.hashMap.get("orgRole_"+roleId,false);
		
		var checked = true;
		if(!obj.checked)
		    checked = false;
		var pc = obj.parentNode.parentNode.children[1];
		for(var i=0;i<pc.children.length;i++){
			pc.children[i].checked = checked;
			
			if(checked && !sysUser.haveTheSame(rightArr,pc.children[i].value)){
				rightArr.push(pc.children[i].value);
			}else{
				for(var k=0;k<rightArr.length;k++){
				    if(rightArr[k] == pc.children[i].value){
				    	rightArr.splice(k,1);
				    	break;
				    }
				}
			}
        }
        sysUser.hashMap.put("orgRole_"+roleId,rightArr);
	},
	
	/**
	 * 
	 * 内存加载时过滤没有选中的权限
	 */
	filterRoleRight : function (value){
		var roleId = sysUser.getObj("roleSelect").value;
		var roleRights = sysUser.hashMap.get("orgRole_"+roleId,false);
		for(var i=0;i<roleRights.length;i++){
			if(roleRights[i] == value){
				return "checked";
			}
		}
		return "";
	},
	
	
	
	/**
	 * 显示管理范围
	 */
	showGlfwTree : function(){
		sysUser.showGlfwText();
		sysUser.showDiv("glfwTreeDiv");
	},
	
	/**
	 * 是否显示管理范围按钮
	 * @return {}
	 */
	showGlFwDiv : function(){
		var isShow = false;
		var select = sysUser.getObj("roleSelect");
		if(select.options.length > 1){//当选择的角色是区域管理员或者学校管理员时需添加区域范围
		   isShow = true;
		   sysUser.getObj("glfwTitle").innerHTML = " -"+select.options[select.selectedIndex].text;
		}
		return isShow;
	},
	
	/**
	 * orgId 表示机构或者是学校
	 * roleName 表示是什么样的管理员
	 * type 表示是机构还是学校
	 */
	isLevel : function(orgId,roleName,type){
		var bol=false;
		var resultObj =$.ajax({url:"manage/sysUser_hasLevel.action?orgId="+orgId+"&roleName="+roleName+"&type="+type+"&rdm="+Math.random(),async:false});
    	var operResult  = eval('(' + resultObj.responseText + ')');
    	 if(operResult.status==1){
			 bol=true;
		 }else{
//			alert("请选择对应的管理员所属机构或学校！");
			 bol= false;
		 }
    	 return bol;
	
	},
	
	setDefalutRole : function(type){
		if(type=="1"){
			$("#defalutRole").val("教研员");
		}else if(type=="3"){
			$("#defalutRole").val("机构用户");
		}else if(type=="2"){
			$("#defalutRole").val("老师");
		}else{
			$("#defalutRole").val("");
		}
	},
	
	isCorrectLevel : function(orgId,userId,roleName,type){
		var bol=false;
		var resultObj =$.ajax({url:"manage/sysUser_hasCorrectLevel.action?orgId="+orgId+"&roleName="+roleName+"&userId="+userId+"&type="+type+"&rdm="+Math.random(),async:false});
    	var operResult  = eval('(' + resultObj.responseText + ')');
    	 if(operResult.status==1){
			 bol=true;
		 }else{
			 bol= false;
		 }
    	 return bol;
	
	},
	
	/**
	 * 增加管理范围
	 */
	addglfw : function(){
		var select = sysUser.getObj("roleSelect");
		var userId = $('#userId').val();
		var areaIdArr = sysUser.hashMap.get("glfwId_"+select.value,false);//储存 id
		if(areaIdArr == null)
		    areaIdArr = new Array();
		    
		var areaNameArr = sysUser.hashMap.get("glfwName_"+select.value,false);//储存 名字
		if(areaNameArr == null)
		    areaNameArr = new Array();
		    
		    
		var zTree = $.fn.zTree.getZTreeObj("glfwtree");
		var nodes = zTree.getSelectedNodes();
//		alert(sysUser.getNodeAllIdName(nodes[0],0));
//		alert(sysUser.getNodeAllIdName(nodes[0],1));
//		alert(nodes[0].type);
		if(nodes[0].type=="0"){
			alert("请选择对应的管理部门或学校!");
			return;
		}
		if (select.value == 'instructor' || select.value == 'admin' || select.value=='teacher' || select.value=='parent') {
			var resultObj = $.ajax({url:"manage/sysUser_hasCorrectLevel.action?" +
					"orgId="+nodes[0].id+"&roleName="+select.value+"&userId="+userId+"&type="+nodes[0].type+"&rdm="+Math.random(),async:false});
		    var operResult  = eval('(' + resultObj.responseText + ')');
	    	if(0 == operResult.status){
	    		alert(operResult.msg);
	    		return;
	    	}
		}
		// 通过ajax判断是否是对应的级如果是，添加到div中，如果不是
		else if(!sysUser.isLevel(nodes[0].id,select.value,nodes[0].type)){
			alert("请选择对应的管理员所属机构或学校！");
			return;
		}
		$("#orgId").val(nodes[0].id);
		$("#type").val(nodes[0].type);
		// 根据type 设置角色
		sysUser.setDefalutRole(nodes[0].type);
		
		var showSelectedglfwDiv = sysUser.getObj("showSelectedglfwDiv");
		showSelectedglfwDiv.innerHTML = "";
		var inner = "";
		var id = "area_"+nodes[0].id;
		var text = sysUser.getNodeAllIdName(nodes[0],1);
		inner += '<div class="span1" style="width:auto;">'+text+'<span id="'+id+'" style="color:#0080C0;cursor:pointer;" onclick="sysUser.delglfw(this)">删除</span></div>';
		showSelectedglfwDiv.innerHTML = (showSelectedglfwDiv.innerHTML + inner);
		sysUser.closeInfoDiv();
		return;
		if(select.selectedIndex == (select.options.length-1)){//学校管理员  只能选一个学校
			
//			if(nodes[0].level != (select.selectedIndex+1)){
//				alert("请选择对应的管理范围!");
//			    return;
//			}
			if(nodes[0].level == (select.selectedIndex+1)){
				if(!sysUser.haveTheSame(areaIdArr,sysUser.getNodeAllIdName(nodes[0],0))){
					areaIdArr.splice(0,areaIdArr.length);
					areaNameArr.splice(0,areaNameArr.length);
					areaIdArr.push(sysUser.getNodeAllIdName(nodes[0],0));
					areaNameArr.push(sysUser.getNodeAllIdName(nodes[0],1));
					var id = "area_"+nodes[0].id;
					var text = sysUser.getNodeAllIdName(nodes[0],1);
					//showInfoDiv.innerHTML = "";
					//inner += '<div>'+text+'<button type="button" id="'+id+'" onclick="sysUser.delglfw(this)" class="close"  data-dismiss="modal" title="删除" aria-hidden="true">×</button> </div>';
					showSelectedglfwDiv.innerHTML = "";
					inner += '<div class="span1" style="width:auto;">'+text+'<span id="'+id+'" style="color:#0080C0;cursor:pointer;" onclick="sysUser.delglfw(this)">删除</span></div>';
				}
			}else{
				// 获取id是否是学校并
//				alert(nodes[0].id);
//				alert(nodes[0].type);
				if(nodes[0].type!=2){
					alert("请选择对应的管理范围!");
					return ;
				}else{
					var nodeAllId="1_1_1_"+nodes[0].id;
					if(!sysUser.haveTheSame(areaIdArr,nodeAllId)){
						areaIdArr.splice(0,areaIdArr.length);
						areaNameArr.splice(0,areaNameArr.length);
						areaIdArr.push(nodeAllId);
						areaNameArr.push(sysUser.getNodeAllIdName(nodes[0],1));
						var id = "area_"+nodes[0].id;
						var text = sysUser.getNodeAllIdName(nodes[0],1);
						//showInfoDiv.innerHTML = "";
						//inner += '<div>'+text+'<button type="button" id="'+id+'" onclick="sysUser.delglfw(this)" class="close"  data-dismiss="modal" title="删除" aria-hidden="true">×</button> </div>';
						showSelectedglfwDiv.innerHTML = "";
						inner += '<div class="span1" style="width:auto;">'+text+'<span id="'+id+'" style="color:#0080C0;cursor:pointer;" onclick="sysUser.delglfw(this)">删除</span></div>';
					}
				}
			}
			
		}else{
			for(var i=0;i<nodes.length;i++){//区域管理员
//				if(nodes[i].level != (select.selectedIndex+1)){
				if(nodes[i].level != (select.selectedIndex)){
					 alert("请选择对应的管理范围!");
				     return;
				}
				var nodeAllId = sysUser.getNodeAllIdName(nodes[i],0);
				var nodeAllName = sysUser.getNodeAllIdName(nodes[i],1);
				if(!sysUser.haveTheSame2(areaIdArr,nodeAllId)){
					areaIdArr.splice(0,areaIdArr.length);
					areaNameArr.splice(0,areaNameArr.length);
				     areaIdArr.push(nodeAllId);
				     areaNameArr.push(nodeAllName);
				     var id = "area_"+nodes[i].id;
				     var text = nodeAllName;
				     showSelectedglfwDiv.innerHTML = "";
				    // inner += '<div>'+text+'<button type="button" id="'+id+'" onclick="sysUser.delglfw(this)" class="close"  data-dismiss="modal" title="删除" aria-hidden="true">×</button> </div>';
				     inner += '<div class="span1" style="width:auto;">'+text+'<span id="'+id+'" style="color:#0080C0;cursor:pointer;" onclick="sysUser.delglfw(this)">删除</span></div>';
				}
			}
		}
		//showInfoDiv.innerHTML = showInfoDiv.innerHTML + inner;
//		showSelectedglfwDiv.innerHTML = (showSelectedglfwDiv.innerHTML + inner);
//		sysUser.hashMap.put("glfwId_"+select.value,areaIdArr);
//		sysUser.hashMap.put("glfwName_"+select.value,areaNameArr);
		
		
	},
	
	/**
	 * 删除一个管理范围
	 */
	delglfw : function(obj){
		var padiv = obj.parentNode;
		//var showDiv = sysUser.getObj("showGlfwDiv");
		var showSelectedglfwDiv = sysUser.getObj("showSelectedglfwDiv");
		//if(showSelectedglfwDiv.children.length > 1)
		    showSelectedglfwDiv.removeChild(padiv);
		/*else{
		    alert("请至少保留一个管理范围!");
		    return;
		}*/
		
		var select = sysUser.getObj("roleSelect");    
		var areaIdArr = sysUser.hashMap.get("glfwId_"+select.value,false);
		var areaNameArr = sysUser.hashMap.get("glfwName_"+select.value,false);
		if(areaIdArr == null)
		    return;
		    
		for(var i=0;i<areaIdArr.length;i++){
			var tempArr = areaIdArr[i].split("_");
			var theId = tempArr[tempArr.length-1];
			if(theId == obj.id.substring(5)){
				areaIdArr.splice(i,1);
				areaNameArr.splice(i,1);
				if(areaIdArr.length == 0){
				    sysUser.hashMap.del("glfwId_"+select.value);
				    sysUser.hashMap.del("glfwName_"+select.value);
				}
				break;
			}
		}
		if(areaIdArr.length > 0){
		    sysUser.hashMap.put("glfwId_"+select.value,areaIdArr);
		    sysUser.hashMap.put("glfwName_"+select.value,areaNameArr);
		}
		$("#defalutRole").val("");
		
	},
	
	/**
	 * 获取ztree上某个节点的全名/id 从父节点一直到该节点
	 * @param {} node
	 */
	getNodeAllIdName : function(node,type){
		var zTree = $.fn.zTree.getZTreeObj("glfwtree");
//		if(node == zTree.getNodes()[0])
//		    return null;
		var value = "";
		while(true){
			if(type == 0)
			    value =  node.id +"_"+value;
			else
			    value =  node.name +"&nbsp;&nbsp;"+value;
			    
			    
			if(node.getParentNode() != null /*&& node.getParentNode()!= zTree.getNodes()[0]*/)
				node = node.getParentNode();
			else
				break;
			
		}
		value = value.substring(0,value.length-1);
		return value;
	},
	
	getGisParentNode : function(node){
			if(node.type == 0){
				return node;
			}else{
				while(true){
					node=node.getParentNode();
					if(node.type==0){
						return node;
					}
					
				}
			}
		
	},
	/**
	 * 根据机构或者学校
	 */
	getEduParentNode : function(node){
		if(node==null){
			return node;
		}else{
			var parentnode;
			while(true){
				if(node.type=="0"){
					return node;
				}else{
					parentnode=node.getParentNode();
					if(parentnode==null){
						return node;
					}else{
						node=parentnode;
					}
				}
				
			}
		}
	},
	
	/**
	 * 根据左边树选择的节点,动态加载管理范围树
	 */
	autoLoadZTree : function(){
		var p = window.parent.frames["tree_iframe"];
		var leftTree;
		if (p == undefined) {
			p = window.parent.parent.frames["tree_iframe"];
		}
		if (p != undefined) {
			var leftTree = p.$.fn.zTree.getZTreeObj("schooltree");
			if (leftTree == null) {
				leftTree = p.$.fn.zTree.getZTreeObj("orgtree");
			}			
		}
		var selectedNode = leftTree.getSelectedNodes()[0];
		// modify by dongzhou2
//		var selectedNode = sysUser.getGisParentNode(leftTree.getSelectedNodes()[0]);
		var selectedNode;
		var treeNode; 
		if (leftTree != undefined) {
			
			selectedNode = sysUser.getEduParentNode(leftTree.getSelectedNodes()[0]);
			treeNode = {};
		    treeNode.type= selectedNode.type;
		    treeNode.id= selectedNode.id;
		    treeNode.name=selectedNode.name;
		    treeNode.isParent=selectedNode.isParent;
		} else {
			/**
			treeNode = {};
		    treeNode.type = '1';
		    var resultObj =$.ajax({url:"manage/gisarea_getSysOrgan.action?rdm="+Math.random(),async:false});
		    var eduorg=eval('(' + resultObj.responseText + ')');
		    treeNode.id = eduorg.id;
		    treeNode.name = eduorg.fullName;
		    treeNode.isParent = true;
		    */
		    
		     treeNode={code:100000, id:1, name:"中国", isParent:true, type:'0'};
		}
		
	    var treeNodeArr = new Array();
	    treeNodeArr.push(treeNode);

	    var select = sysUser.getObj("roleSelect");
	    var isShowSchool = false;//是否显示学校    直属校可以挂在市下面，如果选择区域管理员就可以选择学校，这显然不对
	    if(select!=null && select.selectedIndex == (select.options.length-1))
	        isShowSchool = true;
	    if($("#roleSelect").val()=="instructor"){
//	    	zTreeInitByRootSchool("glfwtree",treeNodeArr,false, isShowSchool,null,null,3);
	    	zTreeInitByRootSchool("glfwtree",treeNodeArr,true, false,null,null,1);
	    }else{
//	    	zTreeInitByRoot("glfwtree",treeNodeArr,false, isShowSchool,null,null,1);
	    	zTreeInitByRootSchool("glfwtree",treeNodeArr,true, true,null,null,1,"",true);
	    }
	},
	
	 /**
     * 显示已选的管理范围
     */
	showGlfwText2 : function(){
		var select = sysUser.getObj("roleSelect");
		sysUser.getObj("glfwTitle").innerHTML = " -"+sysUser.getObj("roleSelect").options[select.selectedIndex].text;
		
		//显示已选择的范围
		var showSelectedglfwDiv = sysUser.getObj("showSelectedglfwDiv");
		showSelectedglfwDiv.innerHTML = "";
		
		
		var areaIdArr = sysUser.hashMap.get("glfwId_"+select.value,false);
		var areaNameArr = sysUser.hashMap.get("glfwName_"+select.value,false);
		if(areaIdArr == null)
		   return;
		
		var inner = "";
		for(var i=0;i<areaIdArr.length;i++){
			 var idArr = areaIdArr[i].split("_");
			 var id = idArr[idArr.length-1];
			 id = "area_"+id;
		     var text = areaNameArr[i];
		     inner += '<div class="span1" style="width:auto;">'+text+'</div>';
//		     inner += '<div class="span1" style="width:auto;">'+text+'<span id="'+id+'" style="color:#0080C0;cursor:pointer;" onclick="sysUser.delglfw(this)">删除</span></div>';
		}
		showSelectedglfwDiv.innerHTML = inner;
	},
	
    /**
     * 显示已选的管理范围
     */
	showGlfwText : function(){
		sysUser.autoLoadZTree();//初始化树
		
		/*var zTree = $.fn.zTree.getZTreeObj("glfwtree");
		zTree.expandAll(false);//折叠树  友好用户体验*/	
		
		var select = sysUser.getObj("roleSelect");
		
		//sysUser.getObj("glfwTitle").innerHTML = " -"+sysUser.getObj("roleSelect").options[select.selectedIndex].text;
		
		//显示已选择的范围
		/*var showDiv = sysUser.getObj("showGlfwDiv");
		showDiv.innerHTML = "";
		
		
		var areaIdArr = sysUser.hashMap.get("glfwId_"+select.value,false);
		var areaNameArr = sysUser.hashMap.get("glfwName_"+select.value,false);
		if(areaIdArr == null)
		   return;
		
		var inner = "";
		for(var i=0;i<areaIdArr.length;i++){
			 var idArr = areaIdArr[i].split("_");
			 var id = idArr[idArr.length-1];
			 id = "area_"+id;
		     var text = areaNameArr[i];
		     inner += '<div>'+text+'<button type="button" id="'+id+'" onclick="sysUser.delglfw(this)" class="close"  data-dismiss="modal" title="删除" aria-hidden="true">×</button> </div>';
		}
		showDiv.innerHTML = inner;*/
	},
	
	
	
	/**
	 * 获取权限、学制信息等数据   返回格式  角色1id:权限1，权限2...-角色2id:权限1，权限2...&&&...
	 * @return {}
	 */
	getAjaxReqData : function (){
		
		var data = "";
//		var dataType = "orgRole_"+sysUser.getObj("roleSelect").value;
//		if(sysUser.hashMap.keyLike(dataType)){
//			data += "type:roleRight-";
//			data += sysUser.swicthHashKeyVlaue(dataType);
//		}
//		
//	    dataType = "glfwId_"+sysUser.getObj("roleSelect").value;
//		if(sysUser.hashMap.keyLike(dataType)){
//			data += ";";
//			data += "type:glfwId-";
//			data += sysUser.swicthHashKeyVlaue(dataType);
//		}
		return data;
	},
	
	/**
	 * 把内存中对应的元素转换成向后台发送的数据格式
	 * @param {} dataType
	 * @return {}
	 */
	swicthHashKeyVlaue : function(dataType){
		var areaIdArr = sysUser.hashMap.get(dataType,false);
		var value = (dataType.split("_")[1] +":" +areaIdArr);
		//value = value.substr(0,value.length-1);
		return  value;
	},
	
	
	
	
	
	/**
	 * 冻结多个用户
	 */
	frozenUsers : function (obj){
		var checkeduserIds = "";
		var checkedLoginNames = "";
		if(obj == null){//批量冻结
			checkeduserIds = sysUser.getCheckeduserIds();
			if("" == checkeduserIds){
			   sysUser.showTishiDiv("提示","请选择要冻结的用户!");
			   return;
			}
			checkedLoginNames = sysUser.getCheckedLoginNames();
		}else{//单个冻结
			checkeduserIds = sysUser.getTrIndex(obj);
			checkedLoginNames = sysUser.getTrLoginName(obj);
		}
		if(confirm("确认冻结所选用户的账号?"))
		     location.href = "manage/sysUser_frozenUsers.action?userIds="+checkeduserIds+"&loginNames="+checkedLoginNames+"&rdm="+Math.random();
	},
	
	/**
	 * 冻结多个用户
	 * @author weidai3
	 */
	frozenUsers : function (obj){
		var checkeduserIds = "";
		var checkedLoginNames = "";
		if(obj == null){//批量冻结
			checkeduserIds = sysUser.getCheckeduserIds();
			if("" == checkeduserIds){
			   sysUser.showTishiDiv("提示","请选择要冻结的用户!");
			   return;
			}
			if(sysUser.getCheckedIsOwner()){
				sysUser.showTishiDiv("提示","不能选择当前用户作为删除的用户!");
				 return;
			}
			checkedLoginNames = sysUser.getCheckedLoginNames();
		}else{//单个冻结
			checkeduserIds = sysUser.getTrIndex(obj);
			checkedLoginNames = sysUser.getTrLoginName(obj);
		}
		if(confirm("确认冻结所选用户的账号?"))
		     location.href = "manage/sysUser_frozenUsers.action?userIds="+checkeduserIds+"&loginNames="+checkedLoginNames+"&rdm="+Math.random();
	},
	
	/**
	 * 解冻
	 */
	unFrozenUser : function(obj){
		var userId = sysUser.getTrIndex(obj);
		if(confirm("确认解冻该用户的账号?"))
		     location.href = "manage/sysUser_unFrozenUser.action?userId="+userId+"&rdm"+Math.random();
	},
	
	/**
	 * 解冻
	 * @author weidai3
	 */
	unFrozenUser : function(obj){
		var userId = sysUser.getTrIndex(obj);
		if(confirm("确认解冻该用户的账号?"))
		     location.href = "manage/sysUser_unFrozenUser.action?userId="+userId+"&rdm"+Math.random();
	},
	
	/**
	 * 删除多个用户
	 */
	delUsers : function (obj){
		var checkeduserIds = "";
		var checkedLoginNames = "";
		var isBatch = 1;
		if(obj == null){//批量删除
			checkeduserIds = sysUser.getCheckeduserIds();
			if("" == checkeduserIds){
			   sysUser.showTishiDiv("提示","请选择要删除的用户!");
			   return;
			}
			if(sysUser.getCheckedIsOwner()){
				sysUser.showTishiDiv("提示","不能选择当前用户作为删除的用户!");
				 return;
			}
			checkedLoginNames = sysUser.getCheckedLoginNames();
		}else{
			isBatch = 0;
			checkeduserIds = sysUser.getTrIndex(obj);
			checkedLoginNames = sysUser.getTrLoginName(obj);
		}
		
        if(confirm("确认删除所选用户的管理员角色?")){
//        	 location.href = "manage/sysUser_delManager.action?userIds="+checkeduserIds+"&loginNames="+checkedLoginNames+"&isBatch="+isBatch+"&rdm="+Math.random();
        	 
        	 $("#userIds").val(checkeduserIds);
	         $("#checkedLoginNames").val(checkedLoginNames);
	         $("#isBatch").val(isBatch);
	         $("#csrfFrom").submit();
        }
	},
	
	/**
	 * 重置密码
	 */
	resetPwds : function (obj,pwd){
		var checkeduserIds = "";
		var checkedLoginNames = "";
		var isBatch = 1;
		if(obj == null){//批量重置
			checkeduserIds = sysUser.getCheckeduserIds();
			if("" == checkeduserIds){
			   sysUser.showTishiDiv("提示","请选择要重置密码的用户!");
			   return;
			}
			checkedLoginNames = sysUser.getCheckedLoginNames();
		}else{
			isBatch = 0;
			checkeduserIds = sysUser.getTrIndex(obj);
			checkedLoginNames = sysUser.getTrLoginName(obj);
		}
		
        if(confirm("您确定要将当前选择的账号密码重置为初始密码吗?\n注:所有用户的初始密码均为："+pwd)){
//        	var currentPage=$("#sysUserPageForm").find(".currentPage").val();
//        	location.href = "manage/sysUser_resetPwds.action?userIds="+checkeduserIds+"&loginNames="+checkedLoginNames+"&isBatch="+isBatch+"&rdm="+Math.random()+"&currentPage="+currentPage;
        	 $("#csrfFrom").attr("action","manage/sysUser_resetPwds.action");
        	 $("#userIds").val(checkeduserIds);
	         $("#checkedLoginNames").val(checkedLoginNames);
	         $("#isBatch").val(isBatch);
	         $("#csrfFrom").submit();
        }
	},
	
	
	/**
	 * 按条件查询用户列表
	 */
	search : function (tj){
		
		var role = sysUser.getObj("user_role");
	    var loginName = document.getElementById("user_loginName").value;
	    var userName = document.getElementById("user_userName").value;
	    loginName = sysUser.encode(loginName);
	    userName = sysUser.encode(userName);
//	    if(tj == "role"){
////	    	if(role.value.length == 0){
////	    	 	sysUser.showTishiDiv("提示","无法找到对应的角色列表数据!查询无法进行!");
////	    	    return;
////	    	 }
//	         location.href = "manage/sysUser_selUser.action?type=0&role="+role.value+"&roleSelIndex="+role.selectedIndex+"&loginName="+loginName+"&userName="+userName+"&rdm="+Math.random();
//	    }else if(role != null)
//	         location.href = "manage/sysUser_selUser.action?type=1&role="+role.value+"&roleSelIndex="+role.selectedIndex+"&loginName="+loginName+"&userName="+userName+"&rdm="+Math.random();
//	    else
	    	 location.href = "manage/sysUser_selUser.action?type=1&role="+role.value+"&roleSelIndex="+role.selectedIndex+"&loginName="+loginName+"&userName="+userName+"&rdm="+Math.random();
	    
	},
	
	/**
	 * 查看用户
	 */
	selUser : function (obj,enName){
	    var userId = sysUser.getTrIndex(obj);
	    var currentPage=$("#sysUserPageForm").find(".currentPage").val();
	    location.href = "manage/sysUser_userInfo.action?enName="+enName+"&userId="+userId+"&rdm="+Math.random()+"&currentPage="+currentPage;
	},
	
	/**
	 * 修改用户
	 */
	modifyUser : function (obj){
		var userId = sysUser.getTrIndex(obj);
		var currentPage=$("#sysUserPageForm").find(".currentPage").val();
	    location.href = "manage/sysUser_modifyUser.action?userId="+userId+"&rdm="+Math.random()+"&currentPage="+currentPage;
	},
	
	/**
	 *获取指定行所对应的 用户id
	 *@param 事件触发对象  查看 修改 冻结..
	 */
	getTrIndex : function(obj){
		var trIndex = obj.parentNode.parentNode.rowIndex ;//行号
		var $tbodyTrs = $("#table > tbody >tr");
		return document.getElementById("tr_checkbox_"+(trIndex-1)).value;
	},
	
		/**
	 *获取指定行所对应的 loginName
	 *@param 事件触发对象  查看 修改 冻结..
	 */
	getTrLoginName : function(obj){
		var trIndex = obj.parentNode.parentNode.rowIndex ;//行号
		var $tbodyTrs = $("#table > tbody >tr");
		var loginName = $("#tr_loginName_"+(trIndex-1)+"> span").attr("title");
//		return document.getElementById("tr_loginName_"+(trIndex-1)).innerHTML;
		return loginName;
	},
	/**
	 * 获取哪些用户被选中 用户id
	 */
	getCheckeduserIds : function (){
		var ids = "";
		var $tbodyTrs = $("#table > tbody >tr");
		for(var i = 0 ; i < $tbodyTrs.length; i++){
		    var check = document.getElementById("tr_checkbox_"+i);//$tbodyTrs[i].firstChild.firstChild;
		    if(check.checked)
		    	ids += check.value + ",";
		}
		return ids.substr(0,ids.length-1);
	},
	
	/**
	 * 获取哪些用户被选中，并判断是不是当前用户。
	 */
	getCheckedIsOwner : function (){
		var loginUserId = $("#loginUserId").val();
		var ids = "";
		var $tbodyTrs = $("#table > tbody >tr");
		for(var i = 0 ; i < $tbodyTrs.length; i++){
		    var check = document.getElementById("tr_checkbox_"+i);//$tbodyTrs[i].firstChild.firstChild;
		    if(check.checked){
		    	if(check.value==loginUserId){
		    		return true;
		    	}
		    }
		    	
		}
		return false;
	},
	
	/**
	 * 获取哪些用户被选中 loginName
	 */
	getCheckedLoginNames : function (){
		var loginNames = "";
		var $tbodyTrs = $("#table > tbody >tr");
		for(var i = 0 ; i < $tbodyTrs.length; i++){
		    var check = document.getElementById("tr_checkbox_"+i);//$tbodyTrs[i].firstChild.firstChild;
		    if(check.checked){
//		    	loginNames += document.getElementById("tr_loginName_"+i).innerHTML+ ",";
		    	 loginNames += $("#tr_loginName_"+i+"> span").attr("title")+",";
		    }
		}
		return loginNames.substr(0,loginNames.length-1);
	},
	
	/**
	 * 上传文件检测
	 */
	upFileCheck : function (type){
		var filePath = null;
		if(document.getElementById("sysusersFile") != null)
		    filePath = document.getElementById("sysusersFile").value;
		else if(document.getElementById("upHeadImg") != null)
		    filePath = document.getElementById("upHeadImg").value;
		  
		var index = filePath.lastIndexOf(".");//最后一个.出现的索引
		var fileEnd = filePath.substring(index+1,filePath.length).toUpperCase();//获取上传文件的后缀
		switch(type){
			case 0: {
				if(fileEnd != "XLS" && fileEnd != "XLSX"){
					sysUser.showTishiDiv("提示","批量账号导入文件必须是xls或xlsx文件!");
					return false;
				}
				break;
			}
			case 1: {
				if(filePath.length > 0){
					if(fileEnd != "PNG" && fileEnd != "JPG" && fileEnd != "JPEG" && fileEnd != "BMP"){
						alert("头像文件必须是png|jpg等图片格式文件!");
						return false;
					}
					if(document.getElementById("sysusersFile").files[0].size>2*1024*1024){
						alert("头像文件文件必须小于2MB!");
						return false;
					}
				}
				break;
			}
		}
		
	   return true;
	},
	
	
	/**
	 * 批量导入
	 */
	batchImport : function(){
		sysUser.showDiv("batchImport");
	},
	
	/**
	 * 上传头像
	 */
	headImg : function (){
		window.open('manage/sysUser_tzUpImg.action?rdm='+Math.random(),'','width=550,height=200,left=500,top=250,location=no,menubar=no,status=no,toolbar=no');
	},
	
	
	
	/**
	 * 上传批量导入文件
	 */
	uploadBatchFile : function(){
		if($("#sysUsersFile").val().length == 0){
			//sysUser.showTishiDiv("提示","请选择批量导入文件!");
			alert("请选择批量导入文件!");
			return;
		}
		
		if(!sysUser.upFileCheck(0))
		   return;
		   
	    var form = document.getElementById("upFile_form");
	    var div = document.getElementById("batchImport");
	    div.style.display = "none";
	    
	    
		sysUser.pageDisbale();
		sysUser.showWaitDiv();
	    form.submit();
	},
	
		/**
	 * 上传头像文件
	 */
	uploadHeadImgFile : function(){
		if($("#sysusersFile").val().length == 0){
			alert("请选择头像文件!");
			return;
		}
		if(!sysUser.upFileCheck(1))
		   return;
		   
	    var form = document.getElementById("upFile_form");
	    var div = document.getElementById("upHeadImgDiv");
	    div.style.display = "none";
	    
	    
		sysUser.pageDisbale();
		sysUser.showWaitDiv();
	    form.submit();
	    //window.close();
	},
	
	
	/*************************************************新增用户****************************************************/
	
	/**
	 * 检查 保存条件是否通过
	 */
	checkRequest : function(isModify){
	    if($.trim($("#loginName").val()).length == 0){
	    	sysUser.showTishiDiv("提示","请输入账号!");$("#loginName").focus();return false;
	    }
	   /* if($.trim($("#nickName").val()).length == 0){
	    	sysUser.showTishiDiv("提示","请输入昵称!");$("#nickName").focus();return false;
	    }*/
	    if($.trim($("#realName").val()).length == 0){
	    	sysUser.showTishiDiv("提示","请输入姓名!");$("#realName").focus();return false;
	    }
	    if(isModify == null){
		    if($.trim($("#pwd").val()).length == 0 && $.trim($("#repwd").val()).length == 0){
		    	//判断密码不能全为空格
			    var regSpace = new RegExp(/[ ]+/);
			    if(regSpace.test($("#pwd").val())){
			    	sysUser.showTishiDiv("密码提示",commonPasswordCheck.getPasswordRegText());
			    	return false;
			    }
		    	document.getElementById("pwd").value = "";
		    	document.getElementById("repwd").value = "";
		    }
		    
		    if($("#pwd").val() != $("#repwd").val()){
		    	sysUser.showTishiDiv("提示","两次输入的密码不一致!");$("#pwd").focus();return false;
		    }
		    if($("#pwd").val().length != 0 && $("#repwd").val().length != 0){
//			    var reg = new RegExp(/^\w{6,16}$/);
//			    if(!reg.test($.trim($("#pwd").val()))){
//			    	sysUser.showTishiDiv("提示","密码只能是6到16位的字母、数字、下划线组成!");$("#pwd").focus();return false;
//			    }
		    	if(!commonPasswordCheck.checkPassword($("#pwd").val())){
		    		sysUser.showTishiDiv("密码提示",commonPasswordCheck.getPasswordRegText());$("#pwd").focus();return false;		    		
		    	}
			    
		    }
	    }
	    
	    
	    var reg = new RegExp(/^[0-9a-z]([._]?[0-9a-z])+@([0-9a-z][-\w]*[0-9a-z]\.)+[a-z]{2,9}$/);
	    var obj = document.getElementById("email");//邮箱正则
	    if(obj.value.length > 0){
		    if(!reg.test(obj.value.toLowerCase())){
		    	sysUser.showTishiDiv("提示","输入的邮箱地址不合法!");return false;
		    }
	    }
	    
	    obj = document.getElementById("idCardNo");
	    if(obj.value.length==0){
	    	sysUser.showTishiDiv("提示","请输入身份证号!");return false;
	    }
	    
	    if(obj.value.length > 0){
//	    	reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
//	    	reg = new RegExp(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/);
	    	// 老身份证15位正则
	    	var idCardof15Reg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/;
	    	// 新身份证18位正则
	    	var idCardof18Reg = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
		    if(!idCardof15Reg.test(obj.value)&&(!idCardof18Reg.test(obj.value))){
//	    	 if(!reg.test(obj.value)){
			    	sysUser.showTishiDiv("提示","输入的身份证号不合法!");return false;
			   }
	    }
	    
	    /*obj = document.getElementById("mobile");//手机
	    if(obj.value.length > 0){
		    reg = new RegExp(/^([\d-+]*)$/);//不能加引号
		    if(!reg.test(obj.value)){
		    	sysUser.showTishiDiv("提示","输入的手机号码不合法!");return false;
		    }
	    }*/
	    
	    obj = document.getElementById("mobile");//联系电话
	    if(obj.value.length > 0){
		    reg = new RegExp(/^[1][3587][0-9]{9}$/);//不能加引号
		    if(!reg.test(obj.value)){
		    	sysUser.showTishiDiv("提示","输入的手机号码不合法!");return false;
		    }
	    }
	    /**
		  obj = document.getElementById("postcode");// 邮编正则
		    if(obj.value.length > 0){
			    reg = new RegExp(/^\d{6}$/);// 不能加引号
			    if(!reg.test(obj.value)){
			    	sysUser.showTishiDiv("提示","输入的邮编不合法!");return false;
			    }
		    }
	    */
	    //当选择相应的角色时，检查有没有选择对应的区域
		    /**
	    if(sysUser.getObj("glfwDiv") != null){
	         var select = sysUser.getObj("roleSelect");
	    	 var areaIdArr = sysUser.hashMap.get("glfwId_"+select.value,false);
	    	 if(areaIdArr == null || areaIdArr.length == 0){
	    	    sysUser.showTishiDiv("提示","请选择管理范围!");
	    	    return false;
	    	 }
	    }
	    */
	       
	   
	     obj = document.getElementById("email");//邮箱正则
	     var cacheValue = sysUser.cacheHashMap.get("email",false);
	     if(obj.value.length > 0 && obj.value != cacheValue){
	     	if(!sysUser.checkEmai())
	            return false;
	     }
	     
	     
	     obj = document.getElementById("idCardNo");//身份证号
	     var cacheValue = sysUser.cacheHashMap.get("idCardNo",false);
	     if(obj.value.length > 0 && obj.value != cacheValue){
	     	if(!sysUser.checkIdCardNo())
	            return false;
	     }
	    
	    obj = document.getElementById("mobile");//电话正则
	     cacheValue = sysUser.cacheHashMap.get("mobile",false);
	     if(obj.value.length > 0 && obj.value != cacheValue){
	     	if(!sysUser.checkPhone())
                return false;
	     }
	     
//	     var reg =/^[0-9]*$/; 
//	    if($("#im").val().length>0){
//	    	if(!reg.test($('#im').val())){
//	    		sysUser.showTishiDiv("提示","请正确填写QQ！");
//	    		return false;
//	    	}
//	    }
        if(isModify == null){
        	if(!sysUser.checkAccountgeshi())
        		return false;
        } 
		   
		 if(!sysUser.checkLength())
	         return false;
		   
	    if(isModify == null)//说明是  新增检测
	        return sysUser.checkAccount();
	},
	
	/**
	 * 检查账号格式   只能是字母数字下划线
	 */
	checkAccountgeshi : function(){
		/**
		var value = $("#loginName").val();
		var reg = new RegExp("^[a-zA-Z0-9_@]+$");//不能加引号
		if(!reg.test(value)){
			sysUser.showTishiDiv("提示","用户名只能是字母、数字或下划线或@符号!");return false;
		}
		return true;
		*/
		var value = $("#loginName").val();
		var reg = new RegExp("^[a-zA-Z0-9_@]{2,18}$");//不能加引号
		var regTel = new RegExp("^1[0-9]{10}$"); // 手机号
		var regEmail = new RegExp("^[0-9a-z]([._]?[0-9a-z])+@([0-9a-z][-\w]*[0-9a-z]\.)+[a-z]{2,9}$"); //邮箱
		if(!reg.test(value)||(regTel.test(value))||(regEmail.test(value))){
//		if(!reg.test(value)){
			sysUser.showTishiDiv("提示","用户名只能2-18位的字母、数字或下划线@符号且不能为手机号与邮箱账户!");return false;
		}
		return true;
	},
	
	/**
	 * 检查该账号是否已被使用
	 */
	checkAccount : function(){
		var loginName = $("#loginName").val();
		if($.trim(loginName).length == 0)
			return false;
			
	    var resultObj =$.ajax({url:"manage/sysUser_userAccountIsRepeat.action?loginName="+loginName+"&rdm="+Math.random(),async:false});
    	var operResult  = eval('(' + resultObj.responseText + ')');
    	if(1 == operResult.status){
    		sysUser.showTishiDiv("提示",operResult.msg);
//    		var userId = areaUser.ajax("manage/areaUser_getUserIdByAccount.action?account="+loginName);
//    		if (userId != null) {
//    			$('#multiIdentitySelector').show();
//    			$('#existedUserId').val(userId);
//    		}
//    		$('#multiIdentitySelector').hide();
    		return false;
    	}
    	else{
//    		$('#multiIdentitySelector').hide();
    		return true;
    	}
		
	},
	
	/**
	 * 检查Email是否已被使用
	 */
	checkEmai : function(){
		var email = $("#email").val();
		var userId = $("#userId").val();
		if($.trim(email).length == 0)
			return false;
			
	    var resultObj =$.ajax({url:"manage/sysUser_emailIsRepeat.action?email="+email+"&userId="+userId+"&rdm="+Math.random(),async:false});
    	var operResult  = eval('(' + resultObj.responseText + ')');
    	if(1 == operResult.status){
    		sysUser.showTishiDiv("提示",operResult.msg);
    		return false;
    	}
    	else
    		return true;
		
	},
	
		
	/**
	 * 检查电话是否已被使用
	 */
	checkPhone : function(){
		var mobile = $("#mobile").val();
		var userId = $("#userId").val();
		if($.trim(mobile).length == 0)
			return false;
			
	    var resultObj =$.ajax({url:"manage/sysUser_mobileIsRepeat.action?mobile="+mobile+"&userId="+userId+"&rdm="+Math.random(),async:false});
    	var operResult  = eval('(' + resultObj.responseText + ')');
    	if(1 == operResult.status){
    		sysUser.showTishiDiv("提示",operResult.msg);
    		return false;
    	}
    	else
    		return true;
		
	},
	
	checkIdCardNo : function(){
		var  idCardNo = $("#idCardNo").val();
		var  userId = $("#userId").val();
		if($.trim(idCardNo).length==0){
			return false;
		}
		var resultObj =$.ajax({url:"manage/sysUser_idCardNoIsRepeat.action?idCardNo="+idCardNo+"&userId="+userId+"&rdm="+Math.random(),async:false});
	    var operResult  = eval('(' + resultObj.responseText + ')');
	    	if(1 == operResult.status){
//	    		$('#multiIdentitySelector').hide();
	    		sysUser.showTishiDiv("提示",operResult.msg);
	    		
//	    		var userId = areaUser.ajax("manage/areaUser_getUserIdByAccount.action?idCardNo="+idCardNo);
//	    		if (userId != null) {
//	    			$('#multiIdentitySelector').hide();
//	    			$('#existedUserId').val(userId);
//	    		}
	    		return false;
	    	}
	    	else{
//	    		$('#multiIdentitySelector').hide();
	    		return true;
	    	}
	},
	
	/**
	 * 缓存邮箱地址和电话号码
	 */
	modifyInitPhoneAndEmail : function(){
		//var mobile = sysUser.getObj("mobile").value;
		var email = sysUser.getObj("email").value;
		//sysUser.cacheHashMap.put("mobile",mobile);
		sysUser.cacheHashMap.put("email",email);
	},
	
	/**
	 * 长度检测
	 */
	checkLength : function(){
		var valueArr = new Array();
		var lengthArr = new Array();
		var nameArr = new Array();
		
		var loginName = sysUser.getObj("loginName").value;//用户名 100
		var pwd = null;
		if(sysUser.getObj("pwd") != null)
		    pwd = sysUser.getObj("pwd").value;//密码 255
		var realName = sysUser.getObj("realName").value;//姓名 20
		var email = sysUser.getObj("email").value;//email 255
//		var mobile = sysUser.getObj("mobile").value;//手机20
//		var QQ = sysUser.getObj("im").value;//QQ 20
//		var phone = sysUser.getObj("phone").value;//电话20
		var homeAddress = sysUser.getObj("homeAddress").value;//地址 255
		var description = sysUser.getObj("description").value;//简介255
		
		var nation = sysUser.getObj("nation").value; // 民族
		var nationality = sysUser.getObj("nationality").value; // 国籍
		var nativePlace = sysUser.getObj("nativePlace").value; // 籍贯
		
		
		valueArr.push(loginName);valueArr.push(pwd);
		valueArr.push(realName);
		valueArr.push(email);
//		valueArr.push(mobile);
		
//		valueArr.push(phone);
		valueArr.push(homeAddress);valueArr.push(description);
		valueArr.push(nation);
		valueArr.push(nationality);
		valueArr.push(nativePlace);
//		valueArr.push(QQ);
		
		
		
		
		
		lengthArr.push(80);lengthArr.push(255);
		lengthArr.push(20);
		lengthArr.push(255);
//		lengthArr.push(20);
		lengthArr.push(80);lengthArr.push(80);
		lengthArr.push(20);
		lengthArr.push(20);
		lengthArr.push(20);
		lengthArr.push(20);
		
		nameArr.push("账号");nameArr.push("密码");
		nameArr.push("姓名");
		nameArr.push("电子邮件");
//		nameArr.push("手机电话");
		nameArr.push("家庭地址");nameArr.push("个人简介");
		nameArr.push("民族"); 
		nameArr.push("国籍"); 
		nameArr.push("籍贯"); 
//		nameArr.push("QQ");
		
		
		
		for(var i=0;i<valueArr.length;i++){
			if(valueArr[i] == null)
			    continue;
			if(valueArr[i].length > lengthArr[i]){
				sysUser.showTishiDiv("提示",nameArr[i]+"长度不能超过"+lengthArr[i]);
				return false;
			}
		}
		
		return true;
	},

	/**
	 * 提交新增用户form表单
	 */
	submitInfo : function (){
		
		var roleEnName=$("#roleSelect").val();
//		var select = sysUser.getObj("roleSelect");
		var orgId=$("#orgId").val();
		var type=$("#type").val();
		
		var showSelectedglfwDiv = sysUser.getObj("showSelectedglfwDiv");
		if($.trim(showSelectedglfwDiv.innerHTML)==""){
			alert("请选择管理范围！");
			return false;
		}
		if(!sysUser.isLevel(orgId,roleEnName,type)){
			alert("请选择对应的管理员所属机构，部门或学校！");
			return false;
		};
//		if(!reg.test($('#im').val())){
//			alert("请正确填写QQ！");
//			return false;
//		}
//		document.addUserForm.action = "manage/sysUser_insertUsers.action?data="+sysUser.getAjaxReqData()+"&roleEnName="+roleEnName+"&rmd="+Math.random();
		document.addUserForm.action = "manage/sysUser_insertUsers.action?orgId="+orgId+"&type="+type+"&roleEnName="+roleEnName+"&rmd="+Math.random();
		return sysUser.checkRequest();
	},
	
	/***************************************************修改用户**************************************/
	submitInfo_modify : function (){
//		var roleEnName=$("#roleSelect").val();
//		var orgId=$("#orgId").val();
//		var type=$("#type").val();
//		
//		var showSelectedglfwDiv = sysUser.getObj("showSelectedglfwDiv");
//		if($.trim(showSelectedglfwDiv.innerHTML)==""){
//			alert("请选择管理范围！");
//			return false;
//		}
//		if(!sysUser.isLevel(orgId,roleEnName,type)){
//			alert("请选择对应的管理员所属机构、部门或学校！");
//			return false;
//		};
//		document.modifyUserForm.action="manage/sysUser_updateUser.action?orgId="+orgId+"&type="+type+"&roleEnName="+roleEnName+"&rdm="+Math.random();
		var currentPage=$("#currentPage").val();
		document.modifyUserForm.action="manage/sysUser_updateUser.action?rdm="+Math.random()+"&currentPage="+currentPage;
		return sysUser.checkRequest(true);
	},
	
	viewManageInfo : function(userId){
		var url = "manage/sysUser_viewManageInfo.action"
			+ "?userId=" + userId//用户ID	
			;
		$.layer({
			type : 2,
			shade : [0.5,'#fff',true],
		    fix: false,
			title : ['设置管理员',true],
			iframe : {src : url},
			area : ['600px' , '400px'],
			offset : ['100px', ''],
			closeBtn : [0,true],
			border:[2 , 0.3 , '#000', true],		
			bgcolor : '#e0e0e0',
			close : function(index){				
				layer.close(index);
			}
		});
	},
	
	
	/***************************************************页面功能******************************************/
	/**
	 * 页面遮罩
	 */
	pageDisbale : function(){
	    var zzDiv = document.createElement("div");
	    zzDiv.id = "zhezhaoDiv";
	    zzDiv.style.position = 'absolute';
	    zzDiv.style.top = 0;
        zzDiv.style.left = 0;
        zzDiv.style.width = document.body.offsetWidth+"px";
        zzDiv.style.height = document.body.offsetHeight+"px";
        zzDiv.style.backgroundColor = "#C0C0C0";
        zzDiv.style.mozOpacity = "0.2";
        zzDiv.style.opacity = ".20";
        zzDiv.style.filter = "alpha(opacity=20)";
        zzDiv.style.zIndx = "10000";
        document.body.appendChild(zzDiv);
	},
	
	/**
	 * 让页面恢复可用
	 */
	pageAble : function(){
		document.body.removeChild(document.getElementById("zhezhaoDiv"));
	},
	/**
	 * 显示div
	 */

	/**
	 * 文本提示div
	 * @param {} title 标题
	 * @param {} content 正文
	 */
	showTishiDiv : function(title,content){
		var title_obj = document.getElementById("tishi_title");
		var content_obj = document.getElementById("tishi_content");
		title_obj.innerHTML = title;
		content_obj.innerHTML = content;
		sysUser.showDiv("tishiDiv");
	},
	/**
	 * 提示等待 div
	 */
	showWaitDiv : function(){
		var div = document.getElementById("uploadwaitdiv");
		div.style.display = "block";
	},
	
	showDiv : function(id){
	$('#'+id).modal({
        keyboard: false,
        backdrop: false
    });
	var div = document.getElementById(id);
    div.style.display = "block";
	},
	
	
   	/**
   	 * chechBox全选
   	 */
	allCheck : function(){
		var isAllcheck = false;
		var $tbodyTrs = $("#table > tbody >tr");
		if($tbodyTrs.length > 0){
			isAllcheck = !document.getElementById("tr_checkbox_0").checked;
			for(var i = 0 ; i < $tbodyTrs.length; i++){
			    document.getElementById("tr_checkbox_"+i).checked = isAllcheck;
			}
		}
		document.getElementById("checkall").checked = isAllcheck;
	},
	/**
	 * 取消checkBox全选中
	 */
	clearAllCheck : function (){
		var $tbodyTrs = $("#table > tbody >tr");
		for(var i = 0 ; i < $tbodyTrs.length; i++)
		    document.getElementById("tr_checkbox_"+i).checked = false;
		
		
	},
	/**
	 *  全选或全部取消选中
	 */
	checkAllorClear : function (){
		if(document.getElementById("checkall").checked)
			sysUser.allCheck();
		else
			sysUser.clearAllCheck();
	},
	
	/**
	 * select 根据其值返回文本
	 * @param {} value
	 * @param {} selId
	 * @return {}
	 */
	SelGetTextByValue : function(value,selId){
		var select = sysUser.getObj(selId);
		for(var i=0;i<select.options.length;i++){
			if(select.options[i].value == value)
				 return select.options[i].text;
		}
		
	},
	/**
	 * 判断一个checkbox组是否都没全中
	 * @param {} checkobj
	 * @return {Boolean}
	 */
	checkIsAllUncheck : function (checkobj){
		var parent = checkobj.parentNode;
		var isAllUnckeck = true;
		for(var i=0;i<parent.children.length;i++){
			if(parent.children[i].checked){
				isAllUnckeck = false;
			    break;
			}
		}
		if(isAllUnckeck)
		    parent.parentNode.firstChild.firstChild.checked = false;
		else
		    parent.parentNode.firstChild.firstChild.checked = true;
	},
	
	/**
	 * 初始化检测有无模块下的chekckbox全部没选中  有的话该模块的checkbox取消选中
	 */
	initCheckIsAllUncheck  : function(){
	    var rightListDiv = sysUser.getObj("rightListDiv");
		for(var i=0;i<rightListDiv.children.length;i++){
			var div = rightListDiv.children[i];
			var pa = div.children[0];
			var pc = div.children[1];
			var allUnchecked = true;
			for(var k=0;k<pc.children.length;k++){
				if(pc.children[k].checked){
				    allUnchecked = false;
				    break;
				}
			}
			if(allUnchecked)
			   pa.children[0].checked = false;
			
		}
	},
	
	getObj : function(id){
		if(document.getElementById(id) == null)
		   return null; 
		else
		   return document.getElementById(id);
	},
	
	/**
	 * ajax请求
	 * @param {} url
	 * @return {}
	 */
	ajax : function (url){
		var resultObj =$.ajax({url:url,async:false});
		//alert(resultObj.responseText);
		var operResult  = eval('(' + resultObj.responseText + ')');
		if(1 == operResult.status){
			if(operResult.data.length <= 1)//"]"
			   return null;
			return operResult.data;
		}else
		    return null;
	},
	
	
	//编码中文，解决乱码
	encode : function(value){
		return encodeURI( encodeURI(value));
	},
	
	/**
	 * 根据值让select选中
	 * @param {} select
	 * @param {} value
	 */
	selectcheckedByValue : function(select,value){
	   for(var i=0;i<select.options.length;i++){
	        if(select.options[i].value == value){
	             select.selectedIndex = i;
	             break;
	        }
	   }
	},
	
	/**
	 * 冻结多个用户
	 * @author weidai3
	 */
	reFrozenUsers : function (obj){
		var checkeduserIds = "";
		var checkedLoginNames = "";
		var isBatch = 1;
		if(obj == null){//批量冻结
			checkeduserIds = sysUser.getCheckeduserIds();
			if("" == checkeduserIds){
				sysUser.showTishiDiv("提示", "请选择要冻结的用户！");
			   return;
			}
			if(sysUser.getCheckedIsOwner()){
				sysUser.showTishiDiv("提示","不能选择当前登录用户作为冻结的用户!");
				 return;
			}
			checkedLoginNames = sysUser.getCheckedLoginNames();
		}else{//单个冻结
			isBatch = 0;
			checkeduserIds = sysUser.getTrIndex(obj);
			checkedLoginNames = sysUser.getTrLoginName(obj);
		}
		if(confirm("确认冻结所选用户的账号?")){
			var currentPage=$("#sysUserPageForm").find(".currentPage").val();
			location.href = "manage/sysUser_reFrozenUsers.action?userIds="+checkeduserIds+"&loginNames="+checkedLoginNames+"&isBatch="+isBatch+"&rdm="+Math.random()+"&currentPage="+currentPage;
		}
	},
	
	/**
	 * 解冻
	 * @author weidai3
	 */
	unReFrozenUser : function (obj){
		var checkeduserIds = "";
		var checkedLoginNames = "";
		var isBatch = 1;
		if(obj == null){//批量解冻
			checkeduserIds = sysUser.getCheckeduserIds();
			if("" == checkeduserIds){
				sysUser.showTishiDiv("提示", "请选择要解冻的用户！");
			   return;
			}
			if(sysUser.getCheckedIsOwner()){
				sysUser.showTishiDiv("提示","不能选择当前登录用户作为解冻的用户!");
				 return;
			}
			checkedLoginNames = sysUser.getCheckedLoginNames();
		}else{//单个解冻
			isBatch = 0;
			checkeduserIds = sysUser.getTrIndex(obj);
			checkedLoginNames = sysUser.getTrLoginName(obj);
		}
		if(confirm("确认解冻所选用户的账号?")){
			 var currentPage=$("#sysUserPageForm").find(".currentPage").val();
		     location.href = "manage/sysUser_unReFrozenUser.action?userIds="+checkeduserIds+"&loginNames="+checkedLoginNames+"&isBatch="+isBatch+"&rdm="+Math.random()+"&currentPage="+currentPage;
		}
	},
	
	/**
	 * 冻结与解冻状态判断
	 * @author weidai3
	 */
	isFrozenUser : function(obj){
		var state ;
		if(state == 0){
			sysUser.unReFrozenUser(obj);
		}
		sysUser.reFrozenUsers(obj);
	},
	
};